<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="/jsplib/pubhead.jsp"%>
<%@ page import="net.comm.common.ValueMaping" %>
<%@ taglib uri="/WEB-INF/myTaglib.tld" prefix="tag"%>
<%@ taglib prefix="myfn" uri="/WEB-INF/jstlfun.tld" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="x-ua-compatible" content="ie=7" />
	<TITLE>系统参数维护</TITLE>
	<link rel="stylesheet" type="text/css" href="${cpath}/css/adgloab.css"/>
	<link rel="stylesheet" type="text/css" href="${cpath}/css/adstyle.css" />
	
</head>
<body>
<script> 
	//转页面
	var curUserID = '${userID}';
	if((curUserID == "")||(curUserID == null)){
//		parent.window.location.replace("${cpath}/index.jsp"); 
	}
</script>

		<DIV id=admin>

		<!-- 右侧宽栏 {{{ -->
		<div class=group_mid>

		<div class='subtop' >
			<p></p>
			<dl >
				<dt class="tit"><a >系统参数维护</a></dt>
				<dd class="intro"><span>&nbsp;</span></dd>
			</dl>
			<div class='fun'>
				<li><a href="javascript:history.go(-1);">返回上一页</a></li>
			</div>
		</div>
		<div class='whole'><!-- 右侧宽栏 }}}-->
			<form action="${cpath}/prop.do" name="theForm" id="theForm"  method="post" enctype="multipart/form-data" >
				<UL class=detailinfo>
					<LI><STRONG>所属分类：</STRONG><EM>
						<tag:ASSORTPROP name="assortID" tagname='请选择' value='${theForm.assortID}' onchange="check_selassortID_input('dSelparentID', this.value);" onkeydown="catch_keydown(this);"/>
						<DIV style="display:inline;" id=assortinfo><A 
						  onclick="javascript:newassort();" href="#"><FONT color=red>* 新增分类</FONT></A></DIV>
						</EM></LI>
					<LI><STRONG>参数名称：</STRONG><EM>
						<INPUT class=text id=propname value='${theForm.propname}' style="WIDTH:183px"  type=text name=propname maxlength="30"></EM></LI>
					<LI><STRONG>父 参 数：</STRONG><EM><DIV style="display:inline;" id=dSelparentID>
						<tag:PROPERTY name="parentID"  assortID="${theForm.assortID}" tagname='请选择' value='${theForm.parentID}'  onkeydown="catch_keydown(this);" /></DIV></EM></LI>
					<LI><STRONG>显示顺序：</STRONG><EM>
						<INPUT class=text id=disNO value='${theForm.disNO}' style="WIDTH: 110px" name=disNO></EM></LI>
					<!--<LI><STRONG>子 参 数：</STRONG><EM>
						<LABEL ><INPUT id=exist type=radio value=1 name=radioexichiflag class="cbox">&nbsp;存在&nbsp;<INPUT id=noexist type=radio value=2 name=radioexichiflag checked  class="cbox">&nbsp;不存在</LABEL> </EM></LI>-->
					<!--隐藏域-->
					<input type="hidden" name='propID'		value='${theForm.propID}'/>
					<input type="hidden" name='assortname'	value='${theForm.assortname}'/>
					<input type="hidden" name='exichiflag'	value='${theForm.exichiflag}'/>
					<input type="hidden" name='action'		value='${theForm.action}'/>
				</UL><!--结束 }}}-->
				<UL class=detailinfo>
					<li class=btn>	
					<input type="button" name="save"  id="save" onclick="javascript:doConfirm();" class="shortBtn" value="保   存"/>&nbsp;
					<input type="button" name="cancel"  id="cancel" onclick="javascript:history.go(-1);" class="shortBtn" value="取   消"/>&nbsp;
					</li>
				</UL>
			</form>
		</div><!-- whole end }}} -->			
		</DIV><!-- content }}} -->
		</DIV><!-- profile_mid }}} -->
	</DIV><!-- group end }}} -->

</body>
</html>
<!---->

<script>
    /**
     * 检查项目资料维护
     */
	function doConfirm()
	{
		var form = document.theForm;

		var action = form['action'];
		var assortID = form['assortID'];
		var assortname = form['assortname'];
		if(assortID.value == null ||  assortID.value == ""||  assortID.value == "0"){

			var newassortname = form['newassortname'];
			if(newassortname == null )
			{
				alert("【所属分类】不能为空或不符合规范\n");
				return false;
			}
			if(newassortname.value.replace(/(^\s*)|(\s*$)/g,"").length < 1)
			{
				alert("【所属分类】不能为空或不符合规范\n");
				return false;
			}
			assortname.value = newassortname.value;
		}

		var propname = form['propname'];
		if(propname.value == null||propname.value.replace(/(^\s*)|(\s*$)/g,"").length < 1)
  		{
			alert('参数名称不能为空');
			propname.select();
			return ;
		}

		var rc = /^[0-9]*$/;

		var disNO = form['disNO'];

		if(disNO.value != "" && !disNO.value.match(rc))
		{
			alert("【显示顺序】不符合规范\n");
			disNO.select();
			return false;
		}
		/*
		var exichiflag = form['exichiflag'];
		if(action.value == "add"||action.value == "update"){
			var temp=document.getElementsByName("radioexichiflag");
			for (i=0;i<temp.length;i++){
				//遍历Radio
				if(temp[i].checked)
				{
					//获取Radio的值
					exichiflag.value = temp[i].value;
				}
			}
			if(exichiflag.value == "0"||exichiflag.value == null||exichiflag.value.length <1)
			{
				alert('请选择是否存在子属性');
				return ;
			}
		}
		*/
		form.submit();
	}
   /**
    * 
    */
	function newassort()
	{
		assortinfo.innerHTML = "<INPUT class=text style='WIDTH: 183px'  type=text name=newassortname value=''>";
	}
   /**
    * 
    */
	function check_selassortID_input(id,value)
	{
		if(value == ""){
			return;
		}
		var xmlHttp;
		start = true;
		try
		{    // Firefox, Opera 8.0+, Safari    
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{    // Internet Explorer    
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		var url;
			url = "${cpath}/param/getproperty.jsp?assortID="+value;
		if (start)
		{
			document.getElementById(id).innerHTML='读取中……';
			xmlHttp.onreadystatechange=function()
			{
				if(xmlHttp.readyState==4 && xmlHttp.status==200)
				{
					var ret_str = xmlHttp.responseText;
					var dSelparentID = "<select  name='parentID' id='parentID' onkeydown='catch_keydown(this);' value=''>" + ret_str + "</select>";
					document.getElementById(id).innerHTML = dSelparentID;
				}
			}
			xmlHttp.open("GET",url,true);
			xmlHttp.send(null);
		}
	}
  /**
   * 根据具体请求设置各个组件状态	
   */
  function showState()
	{
		var action = '${theForm.action}';
		var form = document.theForm;		
		if(action == 'detail')
		{
           
			document.getElementById("back").style.display = "none";
		}
		else if(action == 'modifyPage' || action == 'update')
		{

			form['action'].value = 'update';
		}else{

			form['action'].value = 'add';
		}
	}
	showState();

</script>

